			<div>
				<ul class="breadcrumb">
					<li>
						<a href="<?php echo site_url("menu/survey");?>">Quản lý khảo sát</a> / Loại khảo sát
					</li>
				</ul>
			</div>
			<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well">
						<h2><i class="icon-list-alt"></i> Loại khảo sát</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						</div>
					</div>
					<div class="box-content">
						<table class="table">
							  <thead>
								  <tr>
									  <th>Tên loại Khảo sát</th>
									  <th></th>
								  </tr>
							  </thead>   
							  <tbody>
                                <?php foreach($stlist as $st){?>
                                <tr>
									<td><?php echo $st->survey_type_name;?></td>
									<td class="right">
										<a class="btn btn-success" href="<?php echo site_url("survey/index/".$st->survey_type_id);?>">
											<i class="icon-zoom-in icon-white"></i>
											Xem
										</a>
										<a class="btn btn-info" href="<?php echo site_url("surveytype/edit/".$st->survey_type_id);?>">
											<i class="icon-edit icon-white"></i>
											Sửa
										</a>
										<a class="btn btn-danger btn-setting" stid="<?php echo $st->survey_type_id;?>" stname="<?php echo $st->survey_type_name;?>" href="#deleteModal">
											<i class="icon-trash icon-white"></i> 
											Xoá
										</a>
									</td>
								</tr>
                                <?php }?>
							  </tbody>
						 </table>
					</div>
				</div><!--/span-->
				<div class="row-fluid">
				<div class="box span12">
					<div class="box-header well">
						<h2><i class="icon-plus"></i> Thêm loại khảo sát</h2>
						<div class="box-icon">
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						</div>
					</div>
					<div class="box-content">
						<form class="form-horizontal" method="post">
							<fieldset>
								<label class="control-label" for="stname">Tên loại khảo sát</label>
								<div class="controls">
								  <input class="input-xlarge focused" id="stname" name="stname" value="<?php echo set_value('stname'); ?>" type="text"/>
                                  <?php echo validation_errors(); ?>
								</div>
								<div class="form-actions">
									<button type="submit" class="btn btn-primary" name="submit" value="create">Lưu</button>
									<button type="reset" class="btn">Hủy</button>
							  </div>
							</fieldset>
						</form>
					</div>
				</div><!--/span-->
                </div><!--/row-->
            </div>
        <!-- Hidden dialog -->
        <!-- Popup delete survey type -->
		<div class="modal hide fade" id="deleteModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Xóa loại khảo sát</h3>
				</div>
                <!-- <form class="form-horizontal"> -->
                <form class="form-horizontal" method="post">
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Bạn có chấp nhận xoá loại khảo sát <b><span id="dstname"></span></b> không?
                                <input id="dstid" name="stid" type="hidden"/>
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thóat</a>
    					<button type="submit" name="submit" value="delete" class="btn btn-primary">Đồng ý</button>
    				</div>
                </form>
			<!-- </form> -->
		</div>
        <!-- Popup notify can't delete survey type -->
		<div class="modal hide fade" id="notifyModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Không thể xóa lọai khảo sát</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Đã tồn tại phiếu khảo sát thuộc loại <b><span id="nstname"></span></b>.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thóat</a>
    				</div>
		</div>
        <!-- Popup notify can't connect to server -->
		<div class="modal hide fade" id="errorModal">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>Error!!!</h3>
				</div>
    				<div class="modal-body">
    					<fieldset>
    						<div class="control-group">
                                Lỗi kết nối đến máy chủ.
    						</div>
    					</fieldset>
    				</div>
    				<div class="modal-footer">
    					<a href="#" class="btn" data-dismiss="modal">Thoát</a>
    				</div>
		</div>

    <!-- Placed at the end of the document so the pages load faster -->
    <!-- Internal Script -->
    <script type="text/javascript">
        $(document).ready(function(){
            //Event of button Delete Stype
            $('a[href="#deleteModal"]').click(function(){
                var stid = $(this).attr("stid");
                var stname = $(this).attr("stname");
                //Check whether stype can be deleted
                $.get("surveytype/check_delete/" + stid,function(data, result){
					if(result == 'success'){
						if(data == true){
							$("#dstid").val(stid);
							$("#dstname").html(stname);
							$("#deleteModal").modal('show');
						}
						else if(data == false){
							$("#nstname").html(stname);
							$("#notifyModal").modal('show');
						}
					}else
						$("#errorModal").modal('show');
                });
            });
        });
    </script>
    <!-- End Internal Script -->